<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<fmt:setBundle basename="baiwa.rta.language.common" />

<script type="text/javascript" src="../js/controller/user/USR001A.js"></script>

<s:form id="user-form" action="saveOrUpdate" method="post" novalidate="novalidate">

<div id="container">
	<div id="content">
		<div class="warpper">
		
		<div class="row">
		    <div class="col-lg-12">
		        <font size="5"><i class="fa fa-edit"></i> Add/Edit User</font>
		    </div>
		</div>
<%-- 			${objUserRole.userGrant} --%>
			<div class="panel panel-default"><div class="panel-body">
			
				<table id="formTable" cellpadding="10px" cellspacing="5" border="0">
					 <tbody><tr height="40px">
					 	<td align="right"><label>Username</label></td>
					 	<td>
					 	<input  id="userId" value="${user.userId}" name="user.userId" type="text" hidden=""/>
					 	
					 	<s:set var="flagEdit">${not empty param['user.userName']}</s:set>
					 	<input  value="${user.userName}" name="user.userName" type="text" hidden="" disabled="#flagEdit" />
					 	<s:textfield  name="user.userName" id="userName"
					 	placeholder="Enter username" 
					 	cssClass="input-default input-edit required" disabled="#flagEdit" /><span class="required"></span></td>
					 	<td align="right"><label>${not empty param['user.userName'] ? "Change Password" : "Password"}</label></td>
					 	<td><input type="password"  name="user.password" id="password" 
					 	placeholder="Enter Password" 
					 	class="input-default input-edit" />
							<c:if test="${empty param['user.userName']}"><span class="required"></span></c:if>
						</td>
		
					 </tr>
					 <tr  height="40px">
					 	<td align="right"><label>First Name</label></td>
					 	<td><s:textfield  name="user.firstName" id="firstName"
					 	placeholder="Enter First Name" 
					 	cssClass="input-default input-edit required" /><span class="required"></span></td>

					 	<td align="right"><label>${not empty param['user.userName'] ? "Confirm Password" : "Confirm Password"}</label></td>
					 	<td><input type="password"  name="confirmPassword" id="confirmPassword" 
						 	placeholder="Enter Confirm Password" 
						 	class="input-default input-edit" />
						 	<c:if test="${empty param['user.userName']}"><span class="required"></span></c:if>
						 	</td>
					 </tr>
					 <tr  height="40px">
					 	<td align="right"><label>Last Name</label></td>
					 	<td><s:textfield  name="user.lastName" id="lastName"
					 	placeholder="Enter Last Name" 
					 	cssClass="input-default input-edit required" /><span class="required"></span></td>
					 	
					 	<td align="right"><label>Role</label></td>
								<td><select id="role" name="user.role"
										<c:forEach var="item" items="${comboRole}">
											<option value="${item.key}"  ${item.key == user.roles[0].roleId ? 'selected="selected"' : ''} >${item.value}</option>
										</c:forEach>
								</select></td>

							</tr>
					 <tr  height="40px">
					 	<td align="right"><label>Email</label></td>
					 	<td><s:textfield  name="user.email" id="email"
					 	placeholder="Enter Email" 
					 	cssClass="input-default input-edit " /></td>
					 
					 	<td align="right"><label>Status</label></td>
							<td>
									<label class="radio-inline"> <input type="radio"
										name="user.active" checked
										 ${user.active == 'Y' ? 'checked' : ''} class="ng-pristine ng-valid" value="Y">
										Active
									</label> <label class="radio-inline"> <input type="radio"
										name="user.active" ${user.active == 'N' ? 'checked' : ''}
										 class="ng-pristine ng-valid"  value="N">
										Inactive
									</label>
							</td>
					 	
					 </tr>
				</tbody></table>
<!-- 			</div> -->
			
			</div>
			</div>
			
			<table>
				<tbody><tr>
					<td align="left">
						<button type="button" class="btn btn-default btn-primary" onclick="location = 'USR001'"><i class="fa fa-hand-o-left"></i> Back</button>
					</td>
					<td align="right">
						<button id="btnSubmit" type="button" class="btn btn-default btn-primary"><i class="fa fa-save"></i> Save</button>
					</td>
				</tr>
			</tbody></table>
			
		</div>
	</div>
</div>

</s:form>
